package com.example.android.story.Utils;

import android.arch.persistence.room.Entity;
import android.arch.persistence.room.ForeignKey;
import android.arch.persistence.room.Index;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;

import cn.bmob.v3.BmobObject;

/**
 * Created by liwei on 2018/5/21.
 */

@Entity(
        tableName = "_actors_in_story"
        ,indices = {@Index("actor_name")}
        ,foreignKeys = {
        @ForeignKey(entity = Story.class,parentColumns = "title",childColumns = "story_title")
        ,@ForeignKey(entity = Actor.class,parentColumns = "actor_name",childColumns = "actor_name")
}
)
public class ActorsInStory {
    @NonNull
    @PrimaryKey
    public String story_title;
    @NonNull
    public String actor_name;

    public BmobObject getBmobObject(){
        ActorsInStoryObj obj=new ActorsInStoryObj();
        obj.setActorName(this.actor_name);
        obj.setStoryTitle(this.story_title);
        return obj;
    }

    public class ActorsInStoryObj extends BmobObject{
        public String storyTitle;
        public String actorName;

        public String getStoryTitle() {
            return storyTitle;
        }

        public void setStoryTitle(String storyTitle) {
            this.storyTitle = storyTitle;
        }

        public String getActorName() {
            return actorName;
        }

        public void setActorName(String actorName) {
            this.actorName = actorName;
        }
    }
}
